<!DOCTYPE html>
<html>
#{include file="header.html"}#
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
  <div class="ibox-content">
    <form class="form-horizontal" method="post" action="#">
      <div class="form-group">
        <label class="col-sm-2 control-label">网站名称</label>
        <div class="col-sm-10">
          <input name="name" class="form-control" type="text" placeholder="输入标题" required/>
          <span class="help-block m-b-none"></span> </div>
      </div>
      <div class="form-group">
        <label class="col-sm-2 control-label">网站网址</label>
        <div class="col-sm-10">
          <input name="url" class="form-control" type="text" placeholder="输入网站网址" required/>
          <span class="help-block m-b-none"></span> </div>
      </div>		
      <div class="form-group text-left">
        <label class="col-sm-2 control-label">客户名称</label>
        <div class="col-sm-10">
          <select data-placeholder="选择分类..." name="customer_id" class="chosen-select customer" style="width: 200px;" tabindex="2">
            <option value="">请选所属客户名称</option>
					  #{foreach from=$customer key=k item=v}#
					  <option value="#{$v.customer_id}#" hassubinfo="true">#{$v.name}#</option>
					  #{/foreach}#
          </select>
        </div>
      </div>
		
      <div class="form-group">
        <label class="col-sm-2 control-label">开始时间</label>
        <div class="col-sm-10">
          <input name="start_date" class="form-control datepicker" type="text"  placeholder="选择服务开始时间"/>
          <span class="help-block m-b-none"></span> </div>
      </div>
		<div class="form-group">
        <label class="col-sm-2 control-label">结束时间</label>
        <div class="col-sm-10">
          <input name="end_date" class="form-control datepicker" type="text" placeholder="选择服务结束时间" required/>
          <span class="help-block m-b-none"></span> </div>
      </div>
		<div class="form-group">
        <label class="col-sm-2 control-label">FTP信息</label>
        <div class="col-sm-10">
				<textarea name="ftp" class="form-control"></textarea>
			</div>
      </div>	
		<div class="form-group">
        <label class="col-sm-2 control-label">ICP信息</label>
        <div class="col-sm-10">
				<textarea name="icp" class="form-control"></textarea>
			</div>
      </div>	
		<div class="form-group">
        <label class="col-sm-2 control-label">介绍</label>
        <div class="col-sm-10">
				<textarea name="intro" class="form-control"></textarea>
			</div>
      </div>		
      <div class="form-group">
        <div class="col-sm-offset-2 col-sm-8">
          <button class="btn btn-w-m btn-info save-form" type="button">保存数据</button>
        </div>
      </div>
    </form>
  </div>
</div>
<!-- 自定义js --> 
<script src="#{$smarty.const.APP}#/View/template/js/content.js?v=1.0.0"></script> 
	
<script>
$(document).ready(function () {
	$('.chosen-select').chosen({search_contains: true});
	$(".customer").val("#{$customer_id}#").trigger("chosen:updated");
	
	$("body").on("click", ".save-form", function() {
		FormData=$("form").serialize();
		$.ajax({
			type: "POST",
			url: "#{$smarty.const.ACT}#/crm/CstWebsite/cst_website_add/",
			data:FormData,
			dataType:"json",
			success: function(data){
				if(data.statusCode=='success'){
					layer.msg('操作成功', {icon: 1}); 		
				}
			},    
			complete: function() {   
				setTimeout(function(){
					//关闭窗口
					var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
					parent.layer.close(index);
				 },800);

   		  },
		});		
	});
});
</script>
</body>
</html>